<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    String realPath = request.getSession().getServletContext().getRealPath("/");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>试卷信息</title>
    <link type="text/css" href="css/base.css" rel="stylesheet"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/menu.js"></script>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script>
    <link href='<%=basePath%>/css/bootstrap-2.3.2.css' rel='stylesheet'>
    <script type="text/javascript" src="<%=basePath%>/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.pnotify.js"></script>
    <link href="<%=basePath%>/css/jquery.pnotify.default.css" rel="stylesheet">

    <style type="text/css">
        .theTd{
            width: 300px;
            height: 30px;
            text-align: center;
        }
    </style>
    <script type="text/javascript">
        function test(testPaper, id) {
            var papers = document.getElementById(testPaper).value;
            var paper = papers.substring(0, 4) + "-" + papers.substring(4, 6) + "-" + papers.substring(6, 8);
            document.getElementById(id).innerHTML = paper;
        }

        function jumpForm(tag){
            $("#submitShowOne"+tag).submit();
        }
    </script>



</head>

<body>
<%@ include file="/page/share/menu.jsp" %>

<div id="content">
    <h2>试卷列表</h2>
    <hr>

    <table style="margin-top: 20px;" class="table table-striped">
        <tr style="background: #cccccc;">
            <td class="theTd">
                试卷名称
            </td>
            <td class="theTd">
                试卷总分
            </td>
            <td class="theTd">
                生成时间
            </td>
            <td class="theTd">
                使用状态
            </td>
            <td class="theTd">
                创建者
            </td>
            <td class="theTd">
                科目
            </td>

        </tr>

        <s:iterator value="pageView.records" var="t" status="n">
            <tr>
                <td style="padding: 5px 0;" class="theTd">

                    <form action="TestPaper!showSingleTestPaper.action" method="post" id="submitShowOne${t.id}">
                        <input type="hidden" name="paperId" value="${t.id}"/>
                        <a href="javascript:void(0)" onclick="jumpForm(${t.id})" >${t.testPaperName}</a>
                    </form>
                </td>
                <td style="padding: 5px 0;" class="theTd">
                        ${t.sumScore}
                </td>
                <td style="padding: 5px 0;" class="theTd">
                    <input type="hidden" id="testPaper${t.id}" value="${t.testPaperId}"/>

                    <div id="test${t.id}"></div>
                    <script type="text/javascript">
                        test("testPaper${t.id}", "test${t.id}");
                    </script>
                </td>
                <td style="padding: 5px 0;" class="theTd">
                    <s:if test="#t.state=true">
                        使用中
                    </s:if>
                    <s:if test="#t.state=false">
                        停止使用
                    </s:if>
                </td>
                <td style="padding: 5px 0;" class="theTd">
                        ${t.owner}
                </td>
                <td style="padding: 5px 0;" class="theTd">
                        ${t.subject.subjectName}
                </td>

            </tr>
        </s:iterator>
    </table>

</div>

<div id="footer">
    <p style="text-align: center;color: #757575;padding: 20px 0px 0px 0px; font:12px;">Copyright © 2010-2013 蓝天白云团队
        版权所有</p>
</div>
</body>
</html>
